package com.example.movie.controller;

import com.example.movie.entity.TVideoType;
import com.example.movie.service.HomePageService;
import com.example.movie.vo.RestResult;
import com.example.movie.vo.RestResultBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 主页Controller
 */
@RestController
@RequestMapping("/homePage")
public class HomePageController {

    @Resource
    HomePageService homePageService;

    /**
     * 首页获取电影类型
     * @return
     */
    @RequestMapping("/getHomePageType")
    public RestResult getHomePageType(){
        List<TVideoType> homePageTypes = homePageService.getHomePageType();
        if (homePageTypes != null) {
            return new RestResultBuilder<>().success("查询成功", homePageTypes);
        } else {
            return new RestResultBuilder<>().error("查询失败");
        }
    }

    
}
